<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">


    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

    <!--- 引入的phpMyAdmin样式 -->
    <!-- <link href="css/print.css" rel="stylesheet"> -->
    <!-- <link href="css/jquery-ui-1.8.16.custom.css" rel="stylesheet"> -->

    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>常规</h5>
            </div>
            <div class="ibox-content">
                <form role="form" class="form-inline">
                    <input type="hidden" id="k" value="<?= $k?>">
                    <div class="form-group">
                        <b>用户名：</b>
                        <input type="text" id="username"  placeholder="请输入用户名" name="added_fields">
                    </div>
                    <div class="form-group">
                        <b>主机/IP：</b>
                        <input type="text" id="mainframe"  placeholder="请输入主机或IP" name="added_fields">
                    </div> 
                    <div class="form-group">
                        <b>密码：</b>
                        <input type="password" id="pass"  placeholder="请输入密码" name="added_fields">
                    </div> 
                    <div class="form-group">
                        <b>确认密码：</b>
                        <input type="password" id="word"  placeholder="再次输入密码" name="added_fields">
                    </div> 
                </form>
            </div>
        </div>
    </div>

    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>服务器权限</h5>
            </div>
            <div class="ibox-content">
                <table class="table">
                    <thead>
                        <tr>
                            <th>Select</th>
                            <th>Insert</th>
                            <th>Update</th>
                            <th>Delete</th>
                            <th>Create</th>
                            <th>Drop</th>
                            <th>Reload</th>
                            <th>Shutdown</th>
                            <th>Process</th>
                            <th>File</th>
                            <th>Grant Option</th>
                            <th>References</th>
                            <th>Index</th>
                            <th>Alter</th>
                            <th>Show Databases</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr id="clone">
                            <td><input type="checkbox" name="list" value="Select"></td>
                            <td><input type="checkbox" name="list" value="Insert"></td>
                            <td><input type="checkbox" name="list" value="Update"></td>
                            <td><input type="checkbox" name="list" value="Delete"></td>
                            <td><input type="checkbox" name="list" value="Create"></td>
                            <td><input type="checkbox" name="list" value="Drop"></td>
                            <td><input type="checkbox" name="list" value="Reload"></td>
                            <td><input type="checkbox" name="list" value="Shutdown"></td>
                            <td><input type="checkbox" name="list" value="Process"></td>
                            <td><input type="checkbox" name="list" value="File"></td>
                            <td><input type="checkbox" name="list" value="Grant Option"></td>
                            <td><input type="checkbox" name="list" value="References"></td>
                            <td><input type="checkbox" name="list" value="Index"></td>
                            <td><input type="checkbox" name="list" value="Alter"></td>
                            <td><input type="checkbox" name="list" value="Show Databases"></td>
                        </tr>
                    </tbody>
                </table>

            </div>
        </div>
    </div>

    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>服务器权限：</h5>
            </div>
            <div class="ibox-content">
                <table class="table">
                    <thead>
                        <tr>
                            <th>Super</th>
                            <th>Create Temporary Tables</th>
                            <th>Lock Tables</th>
                            <th>Execute</th>
                            <th>Replication Slave</th>
                            <th>Replication Client</th>
                            <th>Create View</th>
                            <th>Create Routine</th>
                            <th>Alter Routine</th>
                            <th>Create User</th>
                            <th>Event</th>
                            <th>Trigger</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr id="clone">
                            <td><input type="checkbox" name="list" value="Super"></td>
                            <td><input type="checkbox" name="list" value="Create Temporary Tables"></td>
                            <td><input type="checkbox" name="list" value="Lock Tables"></td>
                            <td><input type="checkbox" name="list" value="Execute"></td>
                            <td><input type="checkbox" name="list" value="Replication Slave"></td>
                            <td><input type="checkbox" name="list" value="Replication Client"></td>
                            <td><input type="checkbox" name="list" value="Create View"></td>
                            <td><input type="checkbox" name="list" value="Create Routine"></td>
                            <td><input type="checkbox" name="list" value="Alter Routine"></td>
                            <td><input type="checkbox" name="list" value="Create User"></td>
                            <td><input type="checkbox" name="list" value="Event"></td>
                            <td><input type="checkbox" name="list" value="Trigger"></td>
                        </tr>
                    </tbody>
                </table>

            </div>
        </div>
    </div>

    
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
                <div class="ibox-tools">
                    <a class="btn btn-info dropdown-toggle">保存</a>
                </div>
        </div>
    </div>
    
    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>
    
    <script src="js/plugins/iCheck/icheck.min.js"></script>

    <script src="js/demo/peity-demo.js"></script>

    <!-- Peity -->
    <script src="js/plugins/peity/jquery.peity.min.js"></script>


    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });

        // 克隆对象

        // 全选
        $(function(){
            $("#selected").click(function(){
            
            })
        });
        $('.dropdown-toggle').click(function(){

            var k = $('#k').val();
            var username = $('#username').val();
            var mainframe = $('#mainframe').val();
            var pass = $('#pass').val();
            var word = $('#word').val();
            var obj=document.getElementsByName('list');
            var s='';
            for(var i=0; i<obj.length; i++){
                if(obj[i].checked) s+=obj[i].value+','; //如果选中，将value添加到变量s中
            }
            if(username==''){
                alert('请输入用户名');
            }else{
                $.ajax({
                    type:'post',
                    url:'?r=user/insertin',
                    data:{'name':username,'mainframe':mainframe,'password':pass,'word':word,'obj':s, 'k':k},
                    dataType:'json',
                    success:function(mas){
                        if(mas==0){
                            location.href = "?r=user/index&k="+k;
                        }
                    }
                })
            }
        })
    </script>
    


</body>

</html>